The present invention relates generally to semiconductor microprocessors, a class of which known as microcontrollers perform selective control functions, and more particularly to an improved microcontroller with code protection.
The evolution of microprocessors into complex instruments and machines has led to sophisticated, fast real-time control capability. Microprocessors of 8, 16 or 32 bit capability with associated interrupt handler chips, programmable timer chips, ROM and RAM chips, have been replaced in many control function instances by single chip microcontrollers with all peripherals embedded on the same chip with the microcontroller. Operation of the chip in an expanded mode enhances the versatility of all on-chip features.
Microcontrollers have a wide diversity of applications. In hand-held devices such as pocket pagers (beepers), the microcontroller is responsive to received characters to interpret them, produce an audible or vibratory signal to notify the user of an incoming message, and produce multiple alphanumeric messages on a suitable display such as an LCD. The microcontroller can recall from its internal memory any or all of the messages received in a given period of time. Among other instrumentation uses are those as meters and testers, capable of carrying out thousands of tests, each in a millisecond or less.
Other applications include keyboard controllers for personal computers, in which the microcontroller serves to offload many tasks formerly handled by the processor, including continuous performance of numerous diagnostic procedures and notification to the processor if a problem is detected. Personal computer applications of microcontrollers include use in modems for command interpretation and data transmission, in printer buffers for high speed dumping of data in preparation for driving the printer at the appropriate speed, and in color plotters, copiers, electronic typewriters/word processors, cable television terminal equipment, lawn sprinkling controllers, credit card phone equipment, cellular telephones, fax machines, automotive applications such as engine control modules, antilock braking systems, automobile suspension control, keyless entry systems, and a host of other industrial and consumer applications.
Typically, a microcontroller includes, among other things, a CPU (central processing unit), a program memory from which the CPU fetches instructions, and a data memory (also called a register file in some architectures) which is readable and writable directly by the CPU. The CPU fetches an instruction from the program memory and addresses the data memory according to an address obtained through the instruction or through an indirect register. The CPU may also operate in conjunction with certain peripherals to perform the control function, including devices such as timers, signal ports, and baud rate generators, among others.
Several addressing modes are common once the instruction is fetched. In some instances an embedded address tells the CPU which data memory location to modify with the current operation. This is a standard architecture for a microcontroller with on board (on chip) memory.
The present invention is directed to microcontroller devices offering code protection. Often, the device manufacturer or the OEM (original equipment manufacturer) who is the initial customer for the device desires to incorporate a code within one or more memories of the microcontroller to prevent instructions in the program memory or data within the data memory from being read out external to the device, or to prevent reprogramming of one or both of those memories.
If, as implemented according to the invention, nonvolatile memory such as electrically erasable (alterable) programmable read only memory (EEPROM) fuses are employed for the code protection, a significant advantage can be obtained. Such fuses may be tested both on and off, and reset to the proper configuration or state (i.e., "1" or "0", as the case may be) by the device manufacturer at final test. An existing technique of code protection employs an EPROM fuse which, by virtue of its plastic packaging (i.e., no capability of exposure to ultraviolet light for erasing the state of the fuse without destruction of the package), is programmable only once. Thus, once the OTP (one-time programmable) EPROM fuse is set for code protection, there is no way to reset it, so the protected data cannot be retrieved or otherwise tampered with.
The problem with such OTP EPROM code protect fusing is that, once set, everyone is locked out, including the device manufacturer. As a practical matter, it is highly desirable to have the capability to test the device one or more times at the factory during the final test stage or during iterative checkout of various program instructions in the program memory. By contrast, an inherent nature of the EEPROM is its capability to be erased and rewritten electrically. Using such a memory cell as a fuse allows the manufacturer to enter the coded instructions or data, as desired, and set and reset the code protection fuse as often as necessary for test purposes. After all testing has been satisfied, the EEPROM fuse is reset to the state to preclude penetration of the code.
However, this presents the problem of how one can reasonably assure with such an implementation that the code protection cannot be broken thereafter. It is axiomatic that if code protection fuses can be set and reset at will at the factory, the distinct probability exists that an unauthorized user can perform the same actions through an appropriate sequence of commands to gain access to or change the "protected" code in the memory.
Accordingly, it is a principal object of the present invention to provide a technique for permanently preventing access to code contained in a microcontroller or other microprocessor memory, once the memory or selected portions thereof are encoded by an authorized party.
Another object of the invention is to provide EEPROM code protection fuses and additional safeguards for coded memory in a microprocessor or microcontroller device.